using System;
using System.Collections.Generic;
using System.Text;

using System.Web.UI;
using System.Web.UI.WebControls;

using Pampa.CRUD.Core;
using Pampa.CRUD.UI.CustomControls;

namespace Pampa.CRUD.Configuration
{
    public class HiddenItem : Item
    {
        HiddenField hiddenField = new HiddenField();        
        
        public HiddenItem() : base()
        {
        }

        #region Properties

        public override Control Control
        {
            get
            {
                if (this.Value != null)
                {
                    hiddenField.Value = this.Value.ToString();

                    if (this.Value is IIdentifiable)
                        hiddenField.Value = ((IIdentifiable)this.Value).Id;
                    else
                        hiddenField.Value = this.Value.ToString();
                }

                return hiddenField;
            }
        }

        #endregion
    }
}
